//
//  ZMToast.m
//  ZMKitDemo
//
//  Created by zm on 2018/6/14.
//  Copyright © 2018年 zm. All rights reserved.
//

#import "ZMToast.h"

@implementation ZMToast

+ (void)showToast:(NSString *)message {
    [self showToast:message inView:nil];
}

+ (void)showToast:(NSString *)message inView:(UIView *)view {
    if (!view) {
        view = [UIApplication sharedApplication].delegate.window;
    }
    [view makeToast:message];
}

+ (void)showToastActivity {
    [self showToastActivityInView:nil];
}

+ (void)showToastActivityInView:(UIView *)view {
    if (!view) {
        view = [UIApplication sharedApplication].delegate.window;
    }
    [view makeToastActivity:CSToastPositionCenter];
}

+ (void)hideToastActivity {
    [self hideToastActivityInView:nil];
}

+ (void)hideToastActivityInView:(UIView *)view {
    if (!view) {
        view = [UIApplication sharedApplication].delegate.window;
    }
    [view hideToastActivity];
}


+ (void)showToastWithMessage:(NSString *)message
                       title:(NSString *)title
                      inView:(UIView *)view {
    [self showToastWithMessage:message title:title image:nil duration:[CSToastManager defaultDuration] inView:view completion:nil];
}

+ (void)showToastWithMessage:(NSString *)message
                       image:(UIImage *)image
                      inView:(UIView *)view {
    [self showToastWithMessage:message title:nil image:image duration:[CSToastManager defaultDuration] inView:view completion:nil];

}

+ (void)showToastWithMessage:(NSString *)message
                       title:(NSString *)title
                       image:(UIImage *)image
                      inView:(UIView *)view {
    [self showToastWithMessage:message title:title image:image duration:[CSToastManager defaultDuration] inView:view completion:nil];

}

+ (void)showToastWithMessage:(NSString *)message
                       title:(NSString *)title
                    duration:(NSTimeInterval)duration
                      inView:(UIView *)view
                  completion:(void(^)(BOOL didTap))completion {
    [self showToastWithMessage:message title:title image:nil duration:duration inView:view completion:completion];

}

+ (void)showToastWithMessage:(NSString *)message
                       image:(UIImage *)image
                    duration:(NSTimeInterval)duration
                      inView:(UIView *)view
                  completion:(void(^)(BOOL didTap))completion {
    [self showToastWithMessage:message title:nil image:image duration:duration inView:view completion:completion];

}

+ (void)showToastWithMessage:(NSString *)message
                       title:(NSString *)title
                       image:(UIImage *)image
                    duration:(NSTimeInterval)duration
                      inView:(UIView *)view
                  completion:(void(^)(BOOL didTap))completion {
    if (!view) {
        view = [UIApplication sharedApplication].delegate.window;
    }
    [view makeToast:message
           duration:duration
           position:CSToastPositionCenter
              title:title
              image:image
              style:nil
         completion:completion];
}


@end

